<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>首页</title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/together.css" />
		<link rel="stylesheet" type="text/css" href="css/indexcss.css"/>
		<style>
			
		</style>
	</head>

	<body>
		<nav class="mui-bar mui-bar-tab">
			<a class="mui-tab-item mui-active" id="1" href="#tabbar">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" id="2" href="#tabbar-with-chat">
				<span class="mui-icon mui-icon-email">
              <!--
              	作者：592176224@qq.com
              	时间：2019-01-15
              	描述：
              	<span class="mui-badge">9</span> -->
				</span>
				<span class="mui-tab-label">书店</span>
			</a>
			<a class="mui-tab-item" id="3" href="#tabbar-with-contact">
				<span class="mui-icon mui-icon-contact"></span>
				<span class="mui-tab-label">制作</span>
			</a>
			<a class="mui-tab-item" id="5" href="#tabbar-with-find">
				<span class="mui-icon mui-icon-find"></span>
				<span class="mui-tab-label">发现</span>
			</a>
			<a class="mui-tab-item" id="4" href="#tabbar-with-map">
				<span class="mui-icon mui-icon-gear"></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>
		<div class="mui-content">
			<div id="tabbar" class="mui-control-content mui-active">
				<div class="hdiv m_barC ">
					<div class="hdivleft mui-icon mui-icon-search"></div>
					<div class="hdivcontent">一起写</div>
					<div class="hdivright ic mui-icon mui-icon-right-nav mui-pull-right"></div>
				</div>
				<div class="ws_headerBg"></div>
				<div class="ws_books_list" id="scroolid">
					<div class="list" id="list">

					</div>
					<div id="footlistdiv">

					</div>
				</div>

			</div>
			<div id="tabbar-with-chat" class="mui-control-content">
				<div class="hdiv m_barC ">
					<div class="hdivleft mui-icon mui-icon-search"></div>
					<div class="hdivcontent">首页</div>
					<div class="hdivright mui-icon mui-icon-search mui-pull-right search1"></div>
				</div>
				<div class="ws_search">
					<div class="ws_searchIption mui-input-row">
						<input type="search" id="search" class="mui-input-clear" placeholder="">
					</div>
					<span class="ws_searchbtn" id="search_btn">搜索</span>

				</div>
				<div id="slider" class="mui-slider">
					<div class="mui-slider-group mui-slider-loop">
						<div class="mui-slider-item mui-slider-item-duplicate">
							<a href="#">
								<img src="images/yuantiao.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="images/shuijiao.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="images/muwu.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="images/cbd.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="images/yuantiao.jpg">
							</a>
						</div>
						<div class="mui-slider-item mui-slider-item-duplicate">
							<a href="#">
								<img src="images/shuijiao.jpg">
							</a>
						</div>
					</div>
					<div class="mui-slider-indicator">
						<div class="mui-indicator mui-active"></div>
						<div class="mui-indicator"></div>
						<div class="mui-indicator"></div>
						<div class="mui-indicator"></div>
					</div>
				</div>
				<div class="ws_homeContent">
					<div id="" class="flex3 ws_homeContent_top">
						<span class="recommend flex5">推荐</span>
						<!-- <span class="change flex5">换一换 <i class="mui-icon mui-icon-loop "></i></span> -->
					</div>
					<div class="books_list flex3" id="booklist">

					</div>
				</div>
			</div>
			<div id="tabbar-with-contact" class="mui-control-content">
				<div class="hdiv m_barC ">
					<div class="hdivleft"></div>
					<div class="hdivcontent">我的书籍</div>
					<div class="hdivright mui-icon mui-icon-extra mui-icon-extra-sweep" id="scan"></div>
				</div>
				<div class="ws_content ws_make flex-jcfs-aicent-fwwrap" id="ulmain">

				</div>
			</div>
			<div id="tabbar-with-find" class="mui-control-content">
						
						<div class="hdiv m_barC ">
							<div></div>
							<div class="hdivcontent">渭书</div>
							<div></div>							
						</div>
		
					<div class="titles">最新发现</div>
				
							<!--<div class="discover_item">
									<div class="headimgs"> <img src="images/60x60.gif" alt="" /> <span>昵称</span></div>
									<div class="books_name">了不起的平凡</div>
									<div class="mui-row">
										<div class="mui-col-sm-8 article">隔着沧桑的轮回陪你对诗,不愿这是他们说的青海湖,心疼吧你只能暗访。隔着沧桑的轮回陪你对诗,不愿这是他们说的青海湖,心疼吧你只能暗访</div>
										<div class="mui-col-sm-4 articleImg"><img src="images/b6-min.jpg" alt="" /></div>
									   	<div class="mui-col-sm-12  Audio">
											<audio id="audioTag">
												<source src="http://www.ytmp3.cn/down/46300.mp3"></source>
											</audio>
											<div class="Audio_img " id="playPause">
												<img src="images/60x60.gif" alt="" />
												<div class="icon-btn"><img src="images/pay.png" /></div>
											</div>
											<div class="time">
				
												<div class="pgs">
													<div class="pgs-play" id="progress" style="width:0%;"></div>
													<span></span>
												</div>
												<div><span class="played-time">0.00</span>/<span id="audioTime">2.00</span></div>
											</div>
										</div>
										   
										   
										   
										   
										   
										   
										   
									</div>
									<div class="discover_bottom">
										<div class="">2018 08.08 10:00</div>
										<div class=" bottom_right">
											<div> <img src="images/coll.png" alt="" /> <span>30</span></div>
											<div> <img src="images/follow.png" alt="" /> <span>20</span></div>
											<div> <img src="images/comment.png" alt="" /> <span>50<span></div> 
										</div>
							</div>
							<div class="discover_item">
								<div class="headimgs"> <img src="images/60x60.gif" alt="" /> <span>昵称</span></div>
								<div class="books_name">了不起的平凡</div>
								<div class="mui-row">
									<div class="mui-col-sm-12 article">隔着沧桑的轮回陪你对诗,不愿这是他们说的青海湖,心疼吧你只能暗访。隔着沧桑的轮回陪你对诗,不愿这是他们说的青海湖,心疼吧你只能暗访</div>
			
									<div class="mui-col-sm-12  Audio">
										<audio id="audioTag">
											<source src="http://www.ytmp3.cn/down/46300.mp3"></source>
										</audio>
										<div class="Audio_img " id="playPause">
											<img src="images/60x60.gif" alt="" />
											<div class="icon-btn"><img src="images/pay.png" /></div>
										</div>
										<div class="time">
			
											<div class="pgs">
												<div class="pgs-play" id="progress" style="width:0%;"></div>
												<span></span>
											</div>
											<div><span class="played-time">0.00</span>/<span id="audioTime">2.00</span></div>
										</div>
									</div>
			
								</div>
								<div class="discover_bottom">
									<div class="">2018 08.08 10:00</div>
									<div class=" bottom_right">
										<div> <img src="images/sc2.png" alt="" /> <span>30</span></div>
										<div> <img src="images/sc2.png" alt="" /> <span>20</span></div>
										<div> <img src="images/sc2.png" alt="" /> <span>50<span></div> 
									</div>
								</div>
							</div>
							<div class="discover_item">-->
								<!--<div class="headimgs"> <img src="images/60x60.gif" alt="" /> <span>昵称</span></div>
										<div class="books_name">了不起的平凡</div>
										<div class="mui-row">
											<div class="mui-col-sm-12 article">隔着沧桑的轮回陪你对诗,不愿这是他们说的青海湖,心疼吧你只能暗访。隔着沧桑的轮回陪你对诗,不愿这是他们说的青海湖,心疼吧你只能暗访</div>
			
											<div class="mui-col-sm-12  Audio">
												<audio id="audioTag">
													<source src="http://www.ytmp3.cn/down/32341.mp3"></source>
												</audio>
												<div class="Audio_img " id="playPause">
													<img src="images/60x60.gif" alt="" />
													<div class="icon-btn"><img src="images/pay.png" /></div>
												</div>
												<div class="time">
			
													<div class="pgs">
														<div class="pgs-play" id="progress" style="width:0%;"></div>
														<span></span>
													</div>
													<div><span class="played-time">0.00</span>/<span id="audioTime">2.00</span></div>
												</div>
											</div>
			
										</div>
										<div class="discover_bottom">
											<div class="">2018 08.08 10:00</div>
											<div class=" bottom_right">
												<div> <img src="images/sc2.png" alt="" /> <span>30</span></div>
												<div> <img src="images/sc2.png" alt="" /> <span>20</span></div>
												<div> <img src="images/sc2.png" alt="" /> <span>50<span></div> 
										</div>
								</div>
							</div>
					</div>-->
					<div class="findContent"></div>
			
					
							
			</div>
			<div id="tabbar-with-map" class="mui-control-content">

				<div class="main">
					<div class="headimg">
						<div class="h">个人中心</div>
						<div class="head">
							<div class="left">
								<img src="images/user-photo.png" id="himg" />
							</div>
							<div class="right">
								<div class="top">
									<span id="nc">
								
							</span>
									<div class="pl10 block" onclick="goperspnal_page('setname')">
										<img class="setimg" src="images/edit1.png" />
									</div>
								</div>
								<div class="bom" id="zh">
								</div>
							</div>
						</div>
					</div>
						<ul class="mui-table-view">
							<li class="mui-table-view-cell mui-media" onclick="goperspnal_page('mywallet')">
								<img class="mui-media-object mui-pull-left" src="images/qb.png">
								<div class="mui-navigate-right">
									我的钱包
								</div>
							</li>
							<li class="mui-table-view-cell" onclick="goperspnal_page('myorder')">
								<img class="mui-media-object mui-pull-left" src="images/dd.png">
								<div class="mui-navigate-right">
									我的订单
								</div>
							</li>
						</ul>
					<div class="jg"></div>
					<ul class="mui-table-view ">
						<li class="mui-table-view-cell" onclick="goperspnal_page('collection')">
							<img class="mui-media-object mui-pull-left" src="images/sc.png">
							<div class="mui-navigate-right">
								我的收藏
							</div>
						</li>
						<li class="mui-table-view-cell" onclick="goperspnal_page('focus')">
							<img class="mui-media-object mui-pull-left" src="images/gz.png">
							<div class="mui-navigate-right">
								我的关注
							</div>
						</li>
						<li class="mui-table-view-cell">
							<img class="mui-media-object mui-pull-left" src="images/fb.png">
							<div class="mui-navigate-right">
								我的发布
							</div>
						</li>
						<!--
                	作者：592176224@qq.com
                	时间：2019-01-22
                	描述：
		     
               
		       
		         -->
						<li class="mui-table-view-cell" onclick="goperspnal_page('audit_information')">
							<img class="mui-media-object mui-pull-left" src="images/Auditing.png">
							<div class="mui-navigate-right">
								我的审核
							</div>
						</li>
						<li class="mui-table-view-cell" onclick="goperspnal_page('address')">
							<img class="mui-media-object mui-pull-left" src="images/dz.png">
							<div class="mui-navigate-right">
								地址管理
							</div>
						</li>
						<li class="mui-table-view-cell" onclick="goperspnal_page('problem')">
							<img class="mui-media-object mui-pull-left" src="images/tx.png">
							<div class="mui-navigate-right">
								问题反馈
								</a>
						</li>
						<li class="mui-table-view-cell" onclick="goperspnal_page('abouts')">
							<img class="mui-media-object mui-pull-left" src="images/abouts.png">
							<div class="mui-navigate-right">
								关于我们
								</a>
						</li>

						<li class="mui-table-view-cell" id="loging">
							<img class="mui-media-object mui-pull-left" src="images/quit.png">
							<div class="mui-navigate-right">
								退出登录
								</a>
						</li>
					</ul>
					</div>
					</div>
					</div>

				</div>

				<script src="js/jquery.min.js"></script>
				<script src="js/mui.min.js"></script>
				<script src="js/mui.lazyload.js"></script>
				<script src="js/mui.lazyload.img.js"></script>
				<script src="js/mui.enterfocus.js"></script>
				<script src="js/req.js"></script>
				<script src="js/util.js"></script>
				<script src="js/muishow.js" type="text/javascript" charset="utf-8"></script>
				<script type="text/javascript">
					var count = 0,
						pagenum1 = 1,
						pagenum = 1;
					var seat = false;
					var indexid = 1;
					window.addEventListener('refresh', function(e) {
						getname();
					})

					window.onload = function() {
						mui.init({
							swipeBack: true
						});
						var slider = mui("#slider");
						slider.slider({
							interval: 3000
						});
						mui.plusReady(function() {
							g("loging").addEventListener("tap", function(e) {
								plus.nativeUI.actionSheet({
									cancel: "取消",
									buttons: [{
										title: "注销当前账号"
									}, {
										title: "直接关闭应用"
									}]
								}, function(e) {
									var index = e.index;
									switch(index) { //case 0: 取消
										case 1: //
											localStorage.clear();
											localStorage.removeItem("accesstoken");
											plus.runtime.restart();
											mui.currentWebview.close();
											break;
										case 2: //
											plus.runtime.quit();
											break;
									}
								});
							})
						})
						booklists(); //商店商品列表
						getbooks(); //文章数据列表
						setbooks(); //制作
						//				getbooks2();//已上架商品列表
						getname(); //个人信息
						addtap("new_books");
						mui('.mui-bar-tab').on('tap', 'a', function(e) {
							indexid = this.getAttribute('id');
						});
					}

					$(".search1").on("click", function() {
						if(!seat) {
							$(".ws_search").css({
								"display": "block"
							});
							seat = true;
						} else {
							$(".ws_search").css({
								"display": "none"
							});
							seat = false;
						}
					})

					$("#search_btn").on("click", function() {
						var val = $("#search").val();
						if(!val) {
							mui.toast("搜索不能为空");
							return;
						}
						booklists(val);
						$(".ws_search").css({
							"display": "none"
						});
						seat = false;
					})

					function addbooks() {
						pagenum1++;
						getbooks();
					}
					
					

					function getbooks(type) {
						//				let data ={
						//					url:"/api/Book/book_list",
						//					data:{
						//						access_token:acctoken()||"",
						//						page:pagenum1,
						//					}
						//				}
						//				ajax(data,function(res){
						//							console.log("文章数据",res);
						//							if(res.code == -1){
						//								mui.toast(res.message);
						//							}
						//							if(res.code == 1){
						//								let data = res.data;
						//								if(data.length>0){
						////									setbooks(data,type);
						//								}else if(pagenum1==1){
						let str = '<div class="ws_nobooks">' +
							'<div class="ws_nobooks_img">' +
							'<div class="ws_100 ">' +
							'<img   data-lazyload="images/nobooks.png" alt="" /></div>' +
							'<div class="ws_nobooks_text">' +
							'我们一直在旅行,一直在等待某个人可以成为我们旅途的伴侣，陪我们走过一段别人无法代替的记忆。在那里，有我们特有的记忆,有我们特有的记忆，亲情之忆、友谊之花、爱情之树、以及遗憾之泪！' +
							'</div></div><div class="flex1">' +
							'<button type="button" class="mui-btn mui-btn-outlined btn1 nobooks_btn" id="new_books1">增加书籍</button>' +
							'</div></div>';
						g('list').innerHTML = str;
						layimg(1)
						addtap("new_books1");
						//								}else{
						//									mui.toast("没有更多数据了");
						//									pagenum1--;
						//								}
						//							}
						//					});
					}

					function setbooks() {
						let str = "";
						//				if(type == "new"){
						//					
						//				}else{
						//					str = g('list').innerHTML;
						//				}
						let data = {
							url: "/api/Book/book_list",
							data: {
								access_token: acctoken() || "",
								page: pagenum1,
							}
						}
						ajax(data, function(res) {
							console.log("文章数据", res);
							if(res.code == -1) {
								mui.toast(res.message);
							}
							if(res.code == 1) {
								let data = res.data;
								//								if(data.length>0){}

								////									
								for(let i = 0; i < data.length; i++) {
									let li = document.createElement('div');
									str += '<div class="mui-card-content ws_card_con">' +
										'<div class="ws_card_authority" onclick="delbook(' + data[i].id + ')"><i class="mui-icon mui-icon-closeempty"></i></div>' +
										'<h1 class="ws_card_title">' + data[i].title + '</h1> ' +
										'<img data-lazyload="' + data[i].cover_path + '" onclick="gobook(' + data[i].id + ')"/> ' +
										'<a class="ws_card_content">文章' + i + '篇</a>' +
										'<a class="ws_card_members">成员' + data[i].users_list.length + '个</a></div>';
								}
								g('ulmain').innerHTML = str;
								layimg(1)
								if(data.length > 10) {
									g("footlistdiv").innerHTML = '<button onclick="addbooks()" type="button" class="butclass">加载更多</button>';
								}

							}
						});
					}

					function booklists(name) {
						let data = {
							url: "/api/Book/shop_book_list",
							data: {
								access_token: acctoken() || "",
								search: name || ""
							}
						}
						ajax(data, function(res) {
							if(res.code == 1) {

								let str = "";
								if(res.data.length > 0) {
									for(let i = 0; i < res.data.length; i++) {
										str += '<div class="books_item" onclick="gohomedet(' + res.data[i].id + ')">' +
											'<div class="books_cover ws_100"><img data-lazyload="' + res.data[i].book_image + '" alt="" />' +
											'</div><div class="ws_spdetail"><div>' +
											//								res.data[i].title +
											'</div><span class="ho_books_price">共 <span style="">' +
											res.data[i].page_total +
											'</span>页 售价<span style="">' +
											res.data[i].price +
											'</span>元</span></div></div></div>';
									}
								} else {
									str = '<div class="nobooks">暂无书籍</div>';
								}
								g("booklist").innerHTML = str;
								layimg(1)
							}
						})
					}

					function getname() {
						let data = {
							url: "/api/Personal/member_info",
							data: {
								access_token: acctoken() || ""
							}
						}
						ajax(data, function(res) {

							if(res.code == -1) {
								mui.toast(res.message);
							}
							if(res.code == 1) {
								let nc = document.getElementById("nc");
								let zh = document.getElementById("zh");
								let himg = document.getElementById("himg");
								nc.innerHTML = res.data[0].nickname;
								localStorage.setItem("zname", res.data[0].nickname);
								zh.innerHTML = res.data[0].account;
								if(res.data[0].headimage.length > 27) {
									himg.src = res.data[0].headimage;
								}
							}
						})

					}

					function delbook(bookid) {
						mui.confirm("是否确定删除？", "", ["取消", "确定"], function(e) {
							if(e.index == 1) {
								console.log("shanchu");
								let data = {
									url: "/api/Book/del_book",
									data: {
										access_token: acctoken(),
										bid: bookid,
									}
								}
								ajax(data, function(res) {
									console.log(res)
									if(res.code == 1) {
										mui.toast("书籍删除成功");
										setbooks("");
									}
								})
							}
						})
					}

					function getbooks2() {
						let data = {
							url: "/api/Book/user_shop_book_list",
							data: {
								access_token: acctoken() || "",
								page: pagenum,
							}
						}
						ajax(data, function(res) {

							if(res.code == -1) {
								mui.toast(res.message);
							}
							if(res.code == 1) {
								let booklist = res.data[0].book_list;
								let booklistreview = res.data[0].book_list_review;
								let umain = g("ulmain");
								if(booklist.length > 0) {
									let str = '';
									for(let i = 0; i < booklist.length; i++) {
										console.log(booklist[i].book_image.length)
										if(booklist[i].book_image.length < 30) {
											booklist[i].book_image == "";
										}
										str += '<div class="bookdiv" onclick="gopayment(' + booklist[i].id + ')">' +
											'<img data-lazyload="' + booklist[i].book_image + '"/>' +
											'</div>';
										/*
										 * <div class="datadiv"><div class="fe09">'+
										booklist[i].title+'||'+booklist[i].nickname+
											'</div><div class="fe09">'+
										booklist[i].page_total+'页||<span class="redcolor"> ￥'+booklist[i].price+'</span>'+
											'</div></div>
										 */
									}
									umain.innerHTML = str;
								} else {
									let str = " <div class='nullbook'>暂无书籍</div>"
									umain.innerHTML = str;
								}
								layimg(1);
							}
						});
					}

					function getbooks3() {
						let data = {
							url: "/api/Book/user_shop_book_list",
							data: {
								access_token: acctoken() || "",
								page: pagenum,
							}
						}
						ajax(data, function(res) {
							console.log(res);
							if(res.code == -1) {
								mui.toast(res.message);
							}
							if(res.code == 1) {
								let booklist = res.data[0].book_list;
								let booklistreview = res.data[0].book_list_review;
								let umain = g("ulmain");
								if(booklist.length > 0) {
									let str = '';
									for(let i = 0; i < booklist.length; i++) {
										str += '<div class="bookdiv">' +
											'<img data-lazyload="' + booklist[i].book_image + '"/>' +
											'</div>';
										/*
										 * <div class="datadiv"><div class="fe09">'+
										booklist[i].title+'||'+booklist[i].nickname+
											'</div><div class="fe09">'+
										booklist[i].page_total+'页||<span class="redcolor"> ￥'+booklist[i].price+'</span>'+
											'</div></div>
										 */
									}
									umain.innerHTML = str;
								} else {
									let str = " <div class='nullbook'>暂无书籍</div>"
									umain.innerHTML = str;
								}
								layimg()
							}
						});
					}

					function addtap(id) {
						g(id).addEventListener('tap', function(event) {
							mui.openWindow({
								url: 'write_together/new_books.html',
								id: 'new_books',
							});
						}, false);
					}
					//			scanf('scan');
					//			function scanf(id){

					g('scan').addEventListener('tap', function(event) {
						mui.openWindow({
							url: 'write_together/scan.html',
							id: 'scan',
						});
					}, false);
					//			}

					function goperspnal_page(page) {
						mui.openWindow({
							url: 'personal/' + page + '.html',
							id: page,
						});
					}

					function gohomedet(sid) {
						
						mui.openWindow({
							url: 'home/home_details.html?sid=' + sid,
							id: 'home_details',
							extras: {
								sid: sid
							}
						});
					}

					function gopayment(bookid) {

						//make/payment.html?bookid
						mui.openWindow({
							url: 'make/payment.html?bookid=' + bookid,
							id: 'home_details',
							extras: {
								bookid: bookid
							}
						});
					}

					function gobook(id) {
						mui.openWindow({
							url: 'write_together/books_detas.html?bid=' + id,
							id: 'books_detas',
						});
					}
					function gorelease(id) {
						mui.openWindow({
							url: 'discover/release.html?id=' + id,
							id: 'release',
						});
					}
					
		$(function(){
			$(".discover_item audio").Audio({});
		})
		circleList();
		function circleList(){
			let data = {
					url: "/api/Circle/circleList",
					data: {
						access_token: acctoken() || "",
						number:'',
						page: '',
					}
				}
				ajax(data, function(res) {
					var text = '',list = res.data[0].data;
						console.log(list);
						for(var i = 0; i< list.length; i++){
								
								console.log(list[i]);
								text += `<div class="discover_item" >
									<div class="headimgs"> <img src="images/60x60.gif" alt="" /> <span>${list[i].member.nickname}</span></div>
									<div class="books_name">${list[i].book.title}</div>
									<div class="mui-row">`;
										
										
										 if(list[i].circle_music){
											   text += `<div class="mui-col-sm-12 article">${list[i].circle_content}</div>
														<div class="mui-col-sm-12  Audio">
													<audio id="audioTag">
														<source src="${list[i].circle_music}"></source>
													</audio>
													<div class="Audio_img " id="playPause">
														<img src="images/60x60.gif" alt="" />
														<div class="icon-btn"><img src="images/pay.png" /></div>
													</div>
													<div class="time">
						
														<div class="pgs">
															<div class="pgs-play" id="progress" style="width:0%;"></div>
															<span></span>
														</div>
														<div><span class="played-time">0.00</span>/<span id="audioTime">0.00</span></div>
													</div>
												</div>`  
										}else{
											 text += `<div class="mui-col-sm-8 article" onClick="gorelease(${list[i].id})">${list[i].circle_content}</div>`
											 if(list[i].circle_img){
											 	  text +=`<div class="mui-col-sm-4 articleImg"><img src="${list[i].circle_img}" alt="" /></div>`;
											 }else{
											 	 text +=`<div class="mui-col-sm-4 articleImg"><video src="${list[i].circle_video}" controls autoplay loop></video></div>`;
											 }
													 
										}
										
									text += `</div>
									<div class="discover_bottom">
										<div class="">${list[i].createtime}</div>
										<div class=" bottom_right">
											<div onclick="deleteColl(${list[i].id})"> <img src="images/coll.png" alt="" /> <span>30</span></div>

											<div> <img src="images/comment.png" alt="" /> <span>50<span></div> 
										</div>
								</div> 
							</div>`
						}
						$('.findContent').html(text);
//						console.log(text);
							
						
				})
						
						
		}
		
		function deleteColl(id){
				  
	        		let data = {
						url:"/api/Book/book_keep_delete",
						data:{
							access_token : acctoken()||"",
							id:id
						}
					}
					ajax(data,function(res){
						if(res.code == -1){
							mui.toast(res.message);
						}
						if(res.code == 1){
							console.log(res);
							bookdetails();
							mui.toast("已取消收藏");
							
						}
					})
	    }

		
		;(function($){
			$.fn.Audio = function(options){
				var obj = {};
				var opt = $.extend({},obj,options);
				$(this).each(function(){
						
						var audiop = $(this).parents('.Audio');
						var audio = $(this)[0];
						//触发获取音频长度
						audio.onloadedmetadata = function(){
							audiop.find("#audioTime").text(transTime(this.duration))
						}

						
						function transTime(time){
							var duration = parseInt(time);
							var minute = parseInt(duration/60);
							var sec = duration%60+''
							var isM0 = ":";
							if(minute == 0){
								minute == '00';
							}else if(minute < 10){
								minute = '0'+minute;
							}
							if(sec.length == 1){
								sec = '0'+sec;
							}
							return minute + isM0 + sec;
						}
			
						
						function updateProgress(){
							var value = Math.round((Math.floor(audio.currentTime) / Math.floor(audio.duration)) * 100 ,0);
							audiop.find('.pgs-play').css('width',value * 1 + '%');
							audiop.find('.played-time').html(transTime(audio.currentTime));
							
						}
						
							
						
						function audioEnded(){
							audio.currentTime = 0;
							audio.pause();
							audiop.find(".icon-btn").text('播放');
						}
						
												
						$(this).next('#playPause').click(function(){
							audio.addEventListener('timeupdate',updateProgress,false);
						    audio.addEventListener('ended',audioEnded,false);
								
							//改变暂停/播放icon
							if(audio.paused){
									var audios =  $(this).parents('.discover_item').siblings('.discover_item');
									audios.find('audio')[0].pause();
									 audiop.find(".icon-btn").html('<img src="images/paused.png" />');
									audio.play();
									
								 audiop.find(".icon-btn").html('<img src="images/pay.png" />');
								 audiop.find(".icon-btn").removeClass('icon-play').addClass('icon-pause');
							}else{
								audio.pause();
								 audiop.find(".icon-btn").html('<img src="images/pay.png" />');
								 audiop.find(".icon-btn").removeClass('icon-pause').addClass('icon-play');
							}
						});
						


						var pgsWidth = audiop.find('.pgs span').width() * 1 ; //0.907是 进度条这个div和整个进度条图片宽度的比例
					    //点击进度条跳到指定点播放
					    audiop.find('.pgs span').click(function (e) {
					    	
					        var rate = (e.offsetX - ($(this).width()-pgsWidth)/2)/pgsWidth;
					        audio.currentTime = audio.duration * rate;
					        updateProgress();
					    });
						
				})
			}
		})(jQuery)
		
					
				</script>
	</body>

</html>